package kasgroup2;

import java.util.ArrayList;
import java.util.HashMap;

class Hotel implements java.io.Serializable {

    private int id;
    private String name;
    private String address;
    private HashMap<Room, Integer> rooms;

    public Hotel(int p_ID, String p_Name, String p_Address, HashMap<Room, Integer> p_Rooms) {
        this.id = p_ID;
        this.name = p_Name;
        this.address = p_Address;
        this.rooms = p_Rooms;
        
    }
    
    public int getID() {
        return this.id;
    }
    
    public HashMap<Room, Integer> getRooms() {
        return rooms;
    }
    
    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    public int getRoomCount() {
        int count = 0;
        for(Integer i : this.rooms.values()) {
            count += i;
        }
        return count;
    }
    
    public int getAvailableRoomCount() {
        int count = 0;
        for(Room r : this.rooms.keySet()) {
            if (r.getIsAvailable()) {
                count++;
            }
        }
        return count;
    }
    
    public double getRoomPrice(EnumRoomType rt) {
        for(Room r : this.rooms.keySet()) {
            if (r.getRoomType().equals(rt)) {
                return r.getRoomTotalPrice();
            }
        }
        return -1;
    }
}